1
general::
Express gratitude for a minor favor or advantage, as in My bag didn't get on the plane but it did arrive in time? give thanks for small blessings. This expression is usually uttered when one encounters an unexpected bit of good fortune.
American Heritage Idioms